home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / Asm / Screens / DoubleBuffer.s next >
Encoding:
Text File  |  1998-03-16  |  2.8 KB  |  124 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;This just shows how to double buffer the screen.  You can also try out
  3. ;triple buffering just by changing the DBLBUFFER flag to TPLBUFFER in the
  4. ;GameScreen.
  5.  
  6.     INCDIR    "GMSDev:Includes/"
  7.     INCLUDE    "dpkernel/dpkernel.i"
  8.  
  9.     SECTION    "Start",CODE
  10.  
  11. ;===========================================================================;
  12. ;                             INITIALISE DEMO
  13. ;===========================================================================;
  14.  
  15.     STARTDPK
  16.  
  17. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  18.     move.l    DPKBase(pc),a6
  19.     lea    ScreenTags(pc),a0    ;Init screen.
  20.     sub.l    a1,a1
  21.     CALL    Init
  22.     tst.l    d0
  23.     beq.s    .Exit
  24.  
  25.     move.l    Screen(pc),a1
  26.     lea    PictureTags(pc),a0    ;Load background picture.
  27.     move.l    GS_MemPtr1(a1),PicData
  28.     sub.l    a1,a1
  29.     CALL    Init
  30.     tst.l    d0
  31.     beq.s    .Exit
  32.  
  33.     move.l    SCRBase(pc),a6
  34.     move.l    Screen(pc),a0
  35.     move.l    Picture(pc),a1
  36.     move.l    PIC_Bitmap(a1),a2
  37.     move.l    GS_Bitmap(a0),a3
  38.     move.l    BMP_Palette(a2),BMP_Palette(a3)
  39.     CALL    scrUpdatePalette
  40.  
  41.     move.l    DPKBase(pc),a6
  42.     moveq    #ID_JOYDATA,d0    ;Get joydata structure.
  43.     CALL    Get
  44.     move.l    d0,JoyData
  45.     beq.s    .Exit
  46.     move.l    d0,a0    ;Initialise the joydata structure.
  47.     sub.l    a1,a1
  48.     CALL    Init
  49.     tst.l    .Exit
  50.  
  51.     move.l    Screen(pc),a0
  52.     CALL    Display
  53.  
  54.     bsr.s    Main
  55.  
  56. .Exit    move.l    DPKBase(pc),a6
  57.     move.l    JoyData(pc),a0
  58.     CALL    Free
  59.     move.l    Picture(pc),a0
  60.     CALL    Free
  61.     move.l    Screen(pc),a0
  62.     CALL    Free
  63.     MOVEM.L    (SP)+,A0-A6/D1-D7
  64.     moveq    #ERR_OK,d0
  65.     rts
  66.  
  67. ;===========================================================================;
  68. ;                                MAIN LOOP
  69. ;===========================================================================;
  70.  
  71. Main:    move.l    SCRBase(pc),a6
  72.     CALL    scrWaitAVBL
  73.  
  74.     move.l    Screen(pc),a0
  75.     CALL    scrSwapBuffers
  76.  
  77.     move.l    DPKBase(pc),a6
  78.     move.l    JoyData(pc),a0
  79.     CALL    Query
  80.     move.l    JoyData(pc),a0
  81.     move.l    JD_Buttons(a0),d0
  82.     btst    #JB_LMB,d0
  83.     beq.s    Main
  84.     rts
  85.  
  86. ;===========================================================================;
  87. ;                                  DATA
  88. ;===========================================================================;
  89.  
  90. JoyData:    dc.l  0
  91. ScreenTags:    dc.l  TAGS_SCREEN
  92. Screen:        dc.l  0
  93.         dc.l  GSA_Width,320
  94.         dc.l  GSA_Height,256
  95.         dc.l  GSA_Attrib,SCR_DBLBUFFER
  96.         dc.l    GSA_BitmapTags,0
  97.         dc.l    BMA_AmtColours,32
  98.         dc.l    TAGEND,0
  99.         dc.l  TAGEND
  100.  
  101. PictureTags:    dc.l  TAGS_PICTURE
  102. Picture:    dc.l  0
  103.         dc.l    PCA_BitmapTags,0
  104.         dc.l    BMA_Data
  105. PicData:    dc.l    0
  106.         dc.l    BMA_Width,320
  107.         dc.l    BMA_Height,256
  108.         dc.l    BMA_AmtColours,32
  109.         dc.l    TAGEND,0
  110.         dc.l  PCA_Source,.file
  111.         dc.l  TAGEND
  112.  
  113. .file        FILENAME "GMS:demos/data/PIC.Green"
  114.  
  115. ;===========================================================================;
  116.  
  117. ProgName:    dc.b  "Double Buffer",0
  118. ProgAuthor:    dc.b  "Paul Manias",0
  119. ProgDate:    dc.b  "January 1998",0
  120. ProgCopyright:    dc.b  "DreamWorld Productions (c) 1996-1998.  Freely distributable.",0
  121. ProgShort:    dc.b  "Double buffer demonstration.",0
  122.         even
  123.  
  124.